package com.rd.student.jike.class1.sunhao.day0731;

import java.util.Random;

public class Test {
    public static void main(String[] args) {

        match();

    }

    public static void match() {
        Random random=new Random();
        int[] ints = new int[20];
        for (int i = 0; i < 20; i++) {
            ints[i] = -1;
        }
        boolean folg=false;
        for (int i = 0; i < 20; i++) {

            int j = (int)(Math.random()*50);
            for (int k = 0; k <= i; k++) {
                if (ints[k] == j) {
                    folg=true;
                    break;
                }
            }
            if (folg){
                i--;
                folg=false;
                continue;
            }else {
                ints[i]=j;

            }
        }
        for (int i=0;i<20;i++){
            System.out.print(ints[i]+"  ");
        }
    }
}
